# Maintainer: Ryuta Suzuki <oroppas@gmail.com>

_realname=path.py
pkgbase=mingw-w64-python-path
pkgname=("${MINGW_PACKAGE_PREFIX}-python3-path"
         "${MINGW_PACKAGE_PREFIX}-python2-path")
pkgver=11.0.1
pkgrel=1
pkgdesc="File system based database that uses python pickles (mingw-w64)"
url="https://pypi.org/project/path.py/"
arch=('any')
license=('MIT')
makedepends=("${MINGW_PACKAGE_PREFIX}-python3-setuptools"
             "${MINGW_PACKAGE_PREFIX}-python2-setuptools"
             "${MINGW_PACKAGE_PREFIX}-python3-colorama"
             "${MINGW_PACKAGE_PREFIX}-python2-colorama")
checkdepends=("${MINGW_PACKAGE_PREFIX}-python3-pytest"
              "${MINGW_PACKAGE_PREFIX}-python2-pytest"
              "${MINGW_PACKAGE_PREFIX}-python3-py"
              "${MINGW_PACKAGE_PREFIX}-python2-py")
_dtoken=c0/8e/737f0e163c74ae0fc54ae3004843f6b630f6b29c83fe0d3c59e715e3d6f0
source=("https://files.pythonhosted.org/packages/${_dtoken}/path.py-${pkgver}.tar.gz")
sha256sums=('e7eb9d0ca4110d9b4d7c9baa0696d8c94f837d622409cefc5ec9e7c3d02ea11f')


prepare() {
  cp -a ${_realname}-${pkgver}{,-py2}
  export SETUPTOOLS_SCM_PRETEND_VERSION=${pkgver}
}

build() {
  cd ${srcdir}/${_realname}-${pkgver}
  python3 setup.py build

  cd ${srcdir}/${_realname}-${pkgver}-py2
  python2 setup.py build
}

#check() {
#    cd ${srcdir}/${_realname}-${pkgver}
#    py.test-3.6
#
#    cd ${srcdir}/${_realname}-${pkgver}-py2
#    py.test-2.7
#}

package_python3-path() {
  depends=("${MINGW_PACKAGE_PREFIX}-python3")

  cd ${srcdir}/${_realname}-${pkgver}
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python3 setup.py install --root=${pkgdir} --prefix=${MINGW_PREFIX} --optimize=1
  install -d ${pkgdir}${MINGW_PREFIX}/share/licenses/python3-${_realname}
  head -n 21 path.py > ${pkgdir}${MINGW_PREFIX}/share/licenses/python3-${_realname}/LICENSE
}

package_python2-path() {
  depends=("${MINGW_PACKAGE_PREFIX}-python2")

  cd ${srcdir}/${_realname}-${pkgver}-py2
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python2 setup.py install --root=${pkgdir} --prefix=${MINGW_PREFIX} --optimize=1
  install -d ${pkgdir}${MINGW_PREFIX}/share/licenses/python2-${_realname}
  head -n 21 path.py > ${pkgdir}${MINGW_PREFIX}/share/licenses/python2-${_realname}/LICENSE
}

package_mingw-w64-i686-python2-path() {
  package_python2-path
}

package_mingw-w64-i686-python3-path() {
  package_python3-path
}

package_mingw-w64-x86_64-python2-path() {
  package_python2-path
}

package_mingw-w64-x86_64-python3-path() {
  package_python3-path
}

# vim:set ts=2 sw=2 et:
